package projects

import (
	"xpms/controllers"
)

// 项目管理
type ProjectAnalysisController struct {
	controllers.BaseController
}

// @Title 整体查询
// @Description 整体查询
// @Param	id		    query 	[]string			"项目id"
// @Param	acceptid		query 	[]string			"指派人"
// @Param	moduleid		query 	[]string			"模块id"
// @Param	type		query 	[]string			"分类"
// @Param	creatId		query 	[]string			"创建人"
// @Param	env		query 	[]string			"环境"
// @Param	level		query 	[]string		"级别"
// @Param	createStarted		query 	[]string		"创建开始时间"
// @Param	createEnd		query 	[]string		"创建结束时间"
// @Success 200 {object} projects.ProjectsAll   int   int  int
// @Failure 403 user not exist
// @router /all/list [get]
func (u *ProjectAnalysisController) AllList() {
	projectid := u.GetStrings("projectid")
	acceptid := u.GetStrings("acceptid")
	projectmoduleid := u.GetStrings("moduleid")
	typec := u.GetStrings("type")
	level := u.GetStrings("level")
	creatId := u.GetStrings("creatId")
	env := u.GetStrings("env")
	createStarted := u.GetString("createStarted")
	createEnd := u.GetString("createEnd")
	// 构建查询条件
	condArr := make(map[string]interface{})
	condArr["projectid"] = projectid
	condArr["creatId"] = creatId
	condArr["acceptid"] = acceptid
	condArr["type"] = typec
	condArr["level"] = level
	condArr["env"] = env
	condArr["projectmoduleid"] = projectmoduleid
	condArr["createStarted"] = createStarted
	condArr["createEnd"] = createEnd
	// 整个项目统计分析
	analysisAllTest := AnlysisTestAllByProject(condArr)
	u.Data["json"] = analysisAllTest
	u.ServeJSON()
}

// @Title 项目整体查询
// @Description 项目整体查询
// @Param	id		path 	string	true		"项目id"
// @Param	acceptid		query 	[]string			"指派人"
// @Param	moduleid		query 	[]string			"模块id"
// @Param	type		query 	[]string			"分类"
// @Param	creatId		query 	[]string			"创建人"
// @Param	env		query 	[]string			"环境"
// @Param	level		query 	[]string		"级别"
// @Param	createStarted		query 	[]string		"创建开始时间"
// @Param	createEnd		query 	[]string		"创建结束时间"
// @Success 200 {object} projects.AnalysisAllTest   int   int  int
// @Failure 403 user not exist
// @router /:id/list [get]
func (u *ProjectAnalysisController) List() {
	idstr := u.GetString(":id")
	acceptid := u.GetStrings("acceptid")
	projectmoduleid := u.GetStrings("moduleid")
	typec := u.GetStrings("type")
	level := u.GetStrings("level")
	creatId := u.GetStrings("creatId")
	env := u.GetStrings("env")
	createStarted := u.GetString("createStarted")
	createEnd := u.GetString("createEnd")
	// 构建查询条件
	condArr := make(map[string]interface{})
	condArr["projectid"] = idstr
	condArr["creatId"] = creatId
	condArr["acceptid"] = acceptid
	condArr["type"] = typec
	condArr["level"] = level
	condArr["env"] = env
	condArr["projectmoduleid"] = projectmoduleid
	condArr["createStarted"] = createStarted
	condArr["createEnd"] = createEnd
	// 整个项目统计分析
	analysisAllTest := AnlysisTestByProject(condArr)
	u.Data["json"] = analysisAllTest
	u.ServeJSON()
}
